
import pandas as pd
from scipy import stats


file_path = 'anova.xlsx'
sheet_name = 'Sheet1'
df = pd.read_excel(file_path, sheet_name=sheet_name)

data_A = df['A']
data_B = df['B']
data_C = df['C']

# 使用SciPy进行基础ANOVA
f_value, p_value = stats.f_oneway(data_A,data_B,data_C)

alpha = 0.05
if p_value < alpha:
    print(f"P值 {p_value:.4f} < {alpha}，拒绝原假设")
    print("解释：至少存在两组数据有显著差异")

else:
    print(f"P值 {p_value:.4f} >= {alpha}，无法拒绝原假设")
    print("解释：数据之间无显著差异")